#import "JobDetailUI.h"

@interface JobDetailUI ()

@end

@implementation JobDetailUI
@synthesize jobBtn;
@synthesize companyBtn;
@synthesize jobTitleLb;
@synthesize addTimeLb;
@synthesize companyDic;
@synthesize salaryLb;
@synthesize salaryValLb;
@synthesize merchantNameLb;
@synthesize merchantNameValLb;
@synthesize addressLb;
@synthesize addressValLb;
@synthesize zhaopinTjLb;
@synthesize contenttextview;
@synthesize henxianView1;
@synthesize henxianView2;
@synthesize henxianView3;

@synthesize jobDescLb;
@synthesize jobDescTv;
@synthesize linkInfoLb;
@synthesize linkmanLb;
@synthesize linkmanValLb;
@synthesize mpLb;
@synthesize emailLb;
@synthesize emailValLb;
@synthesize companyAddressLb;
@synthesize companyAddrValLb;
@synthesize lastTipLb;
@synthesize mpValLb;

@synthesize jobId;

#pragma mark - MWPhotoBrowserDelegate

- (NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser {
    return _photos.count;
}

- (id <MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index {
    if (index < _photos.count)
        return [_photos objectAtIndex:index];
    return nil;
}

- (id <MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser thumbPhotoAtIndex:(NSUInteger)index {
    if (index < _thumbs.count)
        return [_thumbs objectAtIndex:index];
    return nil;
}
-(void)yourHandlingCode:(UIGestureRecognizer *)gestureRecognizer
{
    NSLog(@"点击图片");
    
    UIImageView *view = (UIImageView*)[gestureRecognizer view];
    int tag = view.tag;
    
    
    BOOL displayActionButton = YES;
    BOOL displaySelectionButtons = NO;
    BOOL displayNavArrows = NO;
    BOOL enableGrid = YES;
    BOOL startOnGrid = NO;
    
    
    //Create browser
    MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
    
    browser.displayActionButton = displayActionButton;
    browser.displayNavArrows = displayNavArrows;
    browser.displaySelectionButtons = displaySelectionButtons;
    browser.alwaysShowControls = displaySelectionButtons;
    browser.zoomPhotosToFill = YES;
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
    browser.wantsFullScreenLayout = YES;
#endif
    browser.enableGrid = enableGrid;
    browser.startOnGrid = startOnGrid;
    browser.enableSwipeToDismiss = YES;
   
    [browser setCurrentPhotoIndex:tag];
    
    
    [self.navigationController pushViewController:browser animated:YES];
    
    
    double delayInSeconds = 3;
    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
        
        
    });
    
    
}




-(void)clickOnBackBut{
    [self.navigationController popViewControllerAnimated:NO];
}

-(void)jubaoFn{
    
    [self.view makeToast:@"举报成功,我们的工作人员会尽快处理您反馈的信息" duration:1.0 position:@"center"];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.tableView.separatorStyle=NO;
    
    self.photos=[[NSMutableArray alloc] initWithCapacity:8];
    self.thumbs = [[NSMutableArray alloc] init];
    
    [[SDImageCache sharedImageCache] clearDisk];
    [[SDImageCache sharedImageCache] clearMemory];
    
    
   
    UIImage *headImg=[UIImage imageNamed:@"navigation"];
    headImg=[Tools resizeImageToSize:headImg toSize:CGSizeMake(320, 44)];
    UINavigationBar *navBar = self.navigationController.navigationBar;
#define kSCNavBarImageTag 10
    if ([navBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)])
    {
        [navBar setBackgroundImage:headImg forBarMetrics:UIBarMetricsDefault];
    }
    else
    {
        UIImageView *imageView = (UIImageView *)[navBar viewWithTag:kSCNavBarImageTag];
        if (imageView == nil)
        {
            imageView = [[UIImageView alloc] initWithImage:
                         headImg];
            [imageView setTag:kSCNavBarImageTag];
            [navBar insertSubview:imageView atIndex:0];
            
        }
    }
    //self.tableView.contentInset=UIEdgeInsetsMake(0, 0,900, 0);
    
    self.view.backgroundColor=[UIColor whiteColor];
     
    
    UILabel* titleLb=[[UILabel alloc] initWithFrame:CGRectMake(120, 0, 80, 40)];
    titleLb.text=@"求职详情";
    titleLb.font = [UIFont systemFontOfSize:HEAD_SIZE];
    titleLb.textColor=[UIColor whiteColor];
    titleLb.textAlignment=NSTextAlignmentCenter;
    titleLb.backgroundColor=[UIColor clearColor];
    self.navigationItem.titleView=titleLb;
    
    
    
    
    UIButton* cancelBtn= [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 44)];
    [cancelBtn addTarget:self action:@selector(backFn) forControlEvents:UIControlEventTouchUpInside];
    CGRect frame_1= CGRectMake(0,12, 20,20);
    UIImageView*  backView=[[UIImageView alloc] initWithFrame:frame_1];
    UIImage* image= [UIImage imageNamed:@"back2016"];
    backView.image=image;
    [cancelBtn addSubview:backView];
    self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc] initWithCustomView:cancelBtn];
    
    
    
    
    UIButton*  jubaoBtn=[[UIButton alloc] initWithFrame:CGRectMake(240, 5, 30, 34)];
    [jubaoBtn addTarget:self action:@selector(jubaoFn) forControlEvents:UIControlEventTouchUpInside];
    
    UILabel* jubaoLb=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 30, 34)];
    jubaoLb.text=@"举报";
    jubaoLb.font=[UIFont systemFontOfSize:14];
    jubaoLb.textColor=[UIColor whiteColor];
    jubaoLb.backgroundColor=[UIColor clearColor];
    [jubaoBtn addSubview:jubaoLb];
    self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc] initWithCustomView:jubaoBtn];

    
    [NSThread detachNewThreadSelector:@selector(loadJobDetailFn) toTarget:self withObject:nil];
    
    
    
    
    
    
}
-(void)backFn{
    [self.navigationController popViewControllerAnimated:NO];
}
-(void)loadJobThreadFn{
    
    [self.merchantNameLb removeFromSuperview];
    [self.addressLb removeFromSuperview];
    [self.addressValLb removeFromSuperview];
    [self.zhaopinTjLb removeFromSuperview];
    [self.contenttextview removeFromSuperview];
    
    [self.logoView removeFromSuperview];
    [self.linkInfoLb  removeFromSuperview];
    [self.linkmanLb  removeFromSuperview];
    [self.linkmanValLb  removeFromSuperview];
    [self.mpLb  removeFromSuperview];
    [self.emailLb  removeFromSuperview];
    [self.emailValLb  removeFromSuperview];
    [self.companyAddressLb  removeFromSuperview];
    [self.companyAddrValLb  removeFromSuperview];
    [self.lastTipLb  removeFromSuperview];
    [self.mpValLb  removeFromSuperview];
    
    [self.henxianView1 removeFromSuperview];
    [self.henxianView2 removeFromSuperview];
    [self.henxianView3 removeFromSuperview];
    
    
    
    [NSThread detachNewThreadSelector:@selector(loadJobDetailFn) toTarget:self withObject:nil];
}
-(void)loadJobDetailFn{
    NSString *url=@"";
    
    url=[HOST stringByAppendingString:@"index.php/AppJobs/loadJobDetail?id="];
    NSMutableString *mUrl=[[NSMutableString alloc] initWithString:url];
    NSString  *sRectuitId=[NSString stringWithFormat:@"%d",self.jobId];
    [mUrl appendString:sRectuitId];
    
    
    NSLog(@"murl===%@",mUrl);
    
    
    NSError *error;
    NSString *jsonStr = [NSString stringWithContentsOfURL:[NSURL URLWithString:mUrl] encoding:NSUTF8StringEncoding error:&error];
    NSLog(@"jsonStr===%@",jsonStr);
    
    self.dic=[NSDictionary dictionaryWithDictionary:[jsonStr JSONValue]];
    ///
    
    
    
    ///
    [self performSelectorOnMainThread:@selector(didFinishRequest) withObject:nil waitUntilDone:YES];
    
    
    
}
-(float) heightForTextView: (UITextView *)textView WithText: (NSString *) strText{
    float fPadding = 16.0; // 8.0px x 2
    CGSize constraint = CGSizeMake(textView.contentSize.width - fPadding, CGFLOAT_MAX);
    
    CGSize size = [strText sizeWithFont: textView.font constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap];
    
    float fHeight = size.height + 16.0;
    
    return fHeight;
}

-(void)didFinishRequest{
    
    NSString* strMerchant_id=[self.dic objectForKey:@"merchant_id"];
    merchant_id=[strMerchant_id intValue];
    int y=-20;
    
    
    
    self.jobTitleLb=[[UILabel alloc] initWithFrame:CGRectMake(10, y+40, 150, 20)];
    self.jobTitleLb.textAlignment=NSTextAlignmentLeft;
    NSString* title=[self.dic objectForKey:@"reqJobName"];
    self.jobTitleLb.text=title;
    self.jobTitleLb.textColor=[UIColor blackColor];
    [self.view addSubview:self.jobTitleLb];
    //
    
    self.addTimeLb=[[UILabel alloc] initWithFrame:CGRectMake(10, y+60, 150, 20)];
    self.addTimeLb.textAlignment=NSTextAlignmentLeft;
    NSString* add_time=[self.dic objectForKey:@"addTime"];
    add_time=[add_time substringToIndex:10];
    self.addTimeLb.text=add_time;
    self.addTimeLb.textColor=[UIColor grayColor];
    self.addTimeLb.font=[UIFont systemFontOfSize:13];
    [self.view addSubview:self.addTimeLb];
    
    UIImage* henxian=[UIImage imageNamed:@"横线.png"];
    self.henxianView1=[[UIImageView alloc] initWithFrame:CGRectMake(10, y+80, 300, 1)];
    self.henxianView1.image=henxian;
    [self.view addSubview:self.henxianView1];
    //
    self.salaryLb=[[UILabel alloc] initWithFrame:CGRectMake(10, y+83, 60, 20)];
    self.salaryLb.textAlignment=NSTextAlignmentLeft;
    
    
    
    
    //
    self.merchantNameLb=[[UILabel alloc] initWithFrame:CGRectMake(10, y+83+30, 60, 20)];
    self.merchantNameLb.textAlignment=NSTextAlignmentLeft;
    
    
    
    self.addressLb=[[UILabel alloc] initWithFrame:CGRectMake(10, y+83+30*2, 60, 20)];
    self.addressLb.textAlignment=NSTextAlignmentLeft;
    //
    UIImage* aoxian=[UIImage imageNamed:@"aoxian.png"];
    UIImageView*  aoxianView=[[UIImageView alloc] initWithFrame:CGRectMake(0, y+84, 320, 2.5)];
    aoxianView.image=aoxian;
    [self.view addSubview:aoxianView];
    
    
    
    //
    self.zhaopinTjLb=[[UILabel alloc] initWithFrame:CGRectMake(10, y+88, 60, 20)];
    self.zhaopinTjLb.textAlignment=NSTextAlignmentLeft;
    
    
    self.zhaopinTjLb.text=@"自我描述:";
    self.zhaopinTjLb.textColor=[UIColor blackColor];
    self.zhaopinTjLb.font=[UIFont boldSystemFontOfSize:13];
    [self.view addSubview:self.zhaopinTjLb];
    //
    self.contenttextview=[[UITextView alloc] initWithFrame:CGRectMake(10, y+83+30, 280, 140)];
    self.contenttextview.text=[self.dic objectForKey:@"desc"];
    
    [self.view addSubview:self.contenttextview];
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
    {
        NSInteger newSizeH;
        float fPadding = 16.0; // 8.0px x 2
        
        CGSize constraint = CGSizeMake(self.contenttextview.contentSize.width - fPadding, CGFLOAT_MAX);
        
        CGSize size = [self.contenttextview.text sizeWithFont: self.contenttextview.font
                                            constrainedToSize:constraint
                                                lineBreakMode:UILineBreakModeWordWrap];
        newSizeH = size.height + 16.0 - 6;
        self.contenttextview.frame=CGRectMake(20 ,y+83+30,280,newSizeH);
        self.contenttextview.contentSize=CGSizeMake(280, newSizeH);
    }
    else
    {
        CGSize size = [[self.contenttextview text] sizeWithFont:[self.contenttextview font]];
        int length = size.height;  // 2. 取出文字的高度
        int colomNumber = self.contenttextview.contentSize.height/length;  //3. 计算行数
        self.contenttextview.frame=CGRectMake(20 ,y+83+30,280,colomNumber*22);
        self.contenttextview.contentSize=CGSizeMake(280, colomNumber*22);
    }
    //下面设置禁止滚动
    if (self.contenttextview.contentSize.height <= self.contenttextview.frame.size.height) {
        
        [self.contenttextview setUserInteractionEnabled:NO];
    }
    
    //
    int y1=y+83+30;
    
//    int  h1=[self heightForTextView: self.contenttextview WithText: [self.dic objectForKey:@"tj"]];
    
    
    //
    
    int h1=self.contenttextview.contentSize.height;
    
    //
    
    self.henxianView2=[[UIImageView alloc] initWithFrame:CGRectMake(10, y1+h1+10, 300, 1)];
    self.henxianView2.image=henxian;
    [self.view addSubview:self.henxianView2];
    //
    
    
    
    int n=4;
    UIScrollView* sv=[[UIScrollView alloc] initWithFrame:CGRectMake(0, y1+h1+20, 320, 100)];
    
    sv.accessibilityActivationPoint = CGPointMake(110*n, 100);
    sv.contentSize = CGSizeMake(400,
                                0);
    sv.showsHorizontalScrollIndicator = FALSE;
    sv.delegate = self;
    [self.view addSubview:sv];
    
    
    
    UIImageView* view=nil;
    NSString* pic0=[self.dic objectForKey:@"pic0"];
    NSString* pic1=[self.dic objectForKey:@"pic1"];
    NSString* pic2=[self.dic objectForKey:@"pic2"];
    NSString* pic3=[self.dic objectForKey:@"pic3"];
    NSLog(@"图片地址==pic0=====%@",pic0);
    
    MWPhoto* mwPhoto=nil;
    
    
    if (pic0!=nil&&pic0.length>0) {
        pic0=[@"ios/" stringByAppendingString:pic0];
        pic0=[HOST stringByAppendingString:pic0];
        NSLog(@"图片地址==pic0=====%@",pic0);
        view=[[UIImageView alloc] initWithFrame:CGRectMake(10, 0, 100*0.71, 140*0.71)];
        [view setImageWithURL:[NSURL URLWithString:pic0]];
        view.tag=0;
        
        view.userInteractionEnabled=YES;//这句话必须加 否则无法点击
        UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(yourHandlingCode:)];
        [view addGestureRecognizer:singleTap];
        
        mwPhoto=[MWPhoto photoWithURL:[NSURL URLWithString:pic0]];
        
        [self.photos addObject:mwPhoto];
        [self.thumbs addObject:mwPhoto];
        
        [sv addSubview:view];
        
    }
    if (pic1!=nil&&pic1.length>0) {
        pic1=[@"ios/" stringByAppendingString:pic1];
        pic1=[HOST stringByAppendingString:pic1];
        NSLog(@"图片地址==pic1=====%@",pic1);
        view=[[UIImageView alloc] initWithFrame:CGRectMake(10+100*0.71+10, 0, 100*0.71, 140*0.71)];
        [view setImageWithURL:[NSURL URLWithString:pic1]];
        view.tag=1;
        
        view.userInteractionEnabled=YES;//这句话必须加 否则无法点击
        UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(yourHandlingCode:)];
        [view addGestureRecognizer:singleTap];
        
        mwPhoto=[MWPhoto photoWithURL:[NSURL URLWithString:pic1]];
        
        [self.photos addObject:mwPhoto];
        [self.thumbs addObject:mwPhoto];
        
        [sv addSubview:view];
        
    }
    if (pic2!=nil&&pic2.length>0) {
        pic2=[@"ios/" stringByAppendingString:pic2];
        pic2=[HOST stringByAppendingString:pic2];
        NSLog(@"图片地址==pic1=====%@",pic2);
        view=[[UIImageView alloc] initWithFrame:CGRectMake(30+100*0.71*2, 0, 100*0.71, 140*0.71)];
        [view setImageWithURL:[NSURL URLWithString:pic2]];
        view.tag=2;
        
        view.userInteractionEnabled=YES;//这句话必须加 否则无法点击
        UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(yourHandlingCode:)];
        [view addGestureRecognizer:singleTap];
        
        mwPhoto=[MWPhoto photoWithURL:[NSURL URLWithString:pic2]];
        
        [self.photos addObject:mwPhoto];
        [self.thumbs addObject:mwPhoto];
        
        [sv addSubview:view];
        
    }
    if (pic3!=nil&&pic3.length>0) {
        pic3=[@"ios/" stringByAppendingString:pic3];
        pic3=[HOST stringByAppendingString:pic3];
        NSLog(@"图片地址==pic3=====%@",pic3);
        view=[[UIImageView alloc] initWithFrame:CGRectMake(40+100*0.71*3, 0, 100*0.71, 140*0.71)];
        [view setImageWithURL:[NSURL URLWithString:pic3]];
        view.tag=3;
        
        view.userInteractionEnabled=YES;//这句话必须加 否则无法点击
        UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(yourHandlingCode:)];
        [view addGestureRecognizer:singleTap];
        
        mwPhoto=[MWPhoto photoWithURL:[NSURL URLWithString:pic3]];
        
        [self.photos addObject:mwPhoto];
        [self.thumbs addObject:mwPhoto];
        
        [sv addSubview:view];
        
    }
    
    
    
    
    
    
    
    
    
    
    //
    
    int jobY0=y1+h1+10+130;
    self.jobDescTv=[[UITextView alloc] initWithFrame:CGRectMake(10, jobY0, 280, 140)];
    self.jobDescTv.text=[self.dic objectForKey:@"job_desc"];
    
    [self.view addSubview:self.jobDescTv];
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
    {
        NSInteger newSizeH;
        float fPadding = 16.0; // 8.0px x 2
        
        CGSize constraint = CGSizeMake(self.jobDescTv.contentSize.width - fPadding, CGFLOAT_MAX);
        
        CGSize size = [self.jobDescTv.text sizeWithFont: self.jobDescTv.font
                                      constrainedToSize:constraint
                                          lineBreakMode:UILineBreakModeWordWrap];
        newSizeH = size.height + 16.0 - 6;
        self.jobDescTv.frame=CGRectMake(20 ,jobY0,280,newSizeH);
        self.jobDescTv.contentSize=CGSizeMake(280, newSizeH);
    }
    else
    {
        CGSize size = [[self.jobDescTv text] sizeWithFont:[self.jobDescTv font]];
        int length = size.height;  // 2. 取出文字的高度
        int colomNumber = self.jobDescTv.contentSize.height/length;  //3. 计算行数
        self.jobDescTv.frame=CGRectMake(20 ,jobY0,280,colomNumber*22);
        self.jobDescTv.contentSize=CGSizeMake(280, colomNumber*22);
    }
    //下面设置禁止滚动
    if (self.jobDescTv.contentSize.height <= self.jobDescTv.frame.size.height) {
        
        [self.jobDescTv setUserInteractionEnabled:NO];
    }
    //
    h1=self.jobDescTv.contentSize.height;
    
    //
    
    self.linkInfoLb=[[UILabel alloc] initWithFrame:CGRectMake(10, jobY0+h1+15, 300, 20)];
    self.linkInfoLb.text=@"联系方式";
    self.linkInfoLb.textColor=[UIColor grayColor];
    [self.view addSubview:self.linkInfoLb];
    self.henxianView3=[[UIImageView alloc] initWithFrame:CGRectMake(10, jobY0+h1+15+30, 300, 1)];
    self.henxianView3.image=henxian;
    [self.view addSubview:self.henxianView3];
    //
    self.linkmanLb=[[UILabel alloc] initWithFrame:CGRectMake(10, jobY0+h1+15+30+5, 60, 20)];
    self.linkmanLb.text=@"联系人:";
    self.linkmanLb.font=[UIFont systemFontOfSize:13];
    self.linkmanLb.textColor=[UIColor grayColor];
    [self.view addSubview:self.linkmanLb];
    
    NSString* linkman=[self.dic objectForKey:@"linkman"];
    self.linkmanValLb=[[UILabel alloc] initWithFrame:CGRectMake(70, jobY0+h1+15+30+5, 160, 20)];
    self.linkmanValLb.text=linkman;
    self.linkmanValLb.font=[UIFont systemFontOfSize:13];
    self.linkmanLb.textColor=[UIColor blackColor];
    [self.view addSubview:self.linkmanValLb];
    ///////
    self.mpLb=[[UILabel alloc] initWithFrame:CGRectMake(10, jobY0+h1+15+30+5+30, 60, 20)];
    self.mpLb.text=@"电话:";
    self.mpLb.font=[UIFont systemFontOfSize:13];
    self.mpLb.textColor=[UIColor grayColor];
    [self.view addSubview:self.mpLb];
    
    NSString* mp=[self.dic objectForKey:@"mp"];
    self.mpValLb=[[UILabel alloc] initWithFrame:CGRectMake(70, jobY0+h1+15+30+5+30, 160, 20)];
    self.mpValLb.text=mp;
    self.mpValLb.font=[UIFont systemFontOfSize:13];
    self.mpValLb.textColor=[UIColor blackColor];
    [self.view addSubview:self.mpValLb];
    //
    self.emailLb=[[UILabel alloc] initWithFrame:CGRectMake(10, jobY0+h1+15+30+5+30*2, 60, 20)];
    self.emailLb.text=@"Email:";
    self.emailLb.font=[UIFont systemFontOfSize:13];
    self.emailLb.textColor=[UIColor grayColor];
    [self.view addSubview:self.emailLb];
    
    NSString* email=[self.dic objectForKey:@"email"];
    self.emailValLb=[[UILabel alloc] initWithFrame:CGRectMake(70, jobY0+h1+15+30+5+30*2, 160, 20)];
    self.emailValLb.text=email;
    self.emailValLb.font=[UIFont systemFontOfSize:13];
    self.emailValLb.textColor=[UIColor blackColor];
    [self.view addSubview:self.emailValLb];
    //
    
    self.companyAddressLb=[[UILabel alloc] initWithFrame:CGRectMake(10, jobY0+h1+15+30+5+30*3, 60, 20)];
    self.companyAddressLb.text=@"年龄:";
    self.companyAddressLb.font=[UIFont systemFontOfSize:13];
    
    self.companyAddressLb.textColor=[UIColor grayColor];
     [self.view addSubview:self.companyAddressLb];
    
    NSString* strAge=[self.dic objectForKey:@"age"];
    
    
    
    
    
    NSString* addr=[self.dic objectForKey:@"addr"];
    self.companyAddrValLb=[[UILabel alloc] initWithFrame:CGRectMake(70, jobY0+h1+15+30+5+30*3, 160, 20)];
    self.companyAddrValLb.font=[UIFont systemFontOfSize:13];
    self.companyAddrValLb.text=[NSString stringWithFormat:@"%@",strAge];
    self.companyAddrValLb.textColor=[UIColor blackColor];
    [self.view addSubview:self.companyAddrValLb];
    //
    self.lastTipLb=[[UILabel alloc] initWithFrame:CGRectMake(10, jobY0+h1+15+30+5+30*4, 220, 20)];
    self.lastTipLb.font=[UIFont systemFontOfSize:13];
    self.lastTipLb.text=@"联系我时,请说明是在夜店中国看到的";
    self.lastTipLb.textColor=[UIColor grayColor];
    self.lastTipLb.textAlignment=NSTextAlignmentLeft;
    [self.view addSubview:self.lastTipLb];
    
    self.tableView.contentInset=UIEdgeInsetsMake(0, 0, jobY0+h1+15+30+5+30*4+40+100, 0);
    
    //////
    UIButton* shareBtn=[[UIButton alloc] initWithFrame:CGRectMake(30, jobY0+h1+15+30+5+30*4+30, 100, 35)];
    [shareBtn addTarget:self action:@selector(shareFn) forControlEvents:UIControlEventTouchUpInside];
    shareBtn.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"yzh_focus"]];
    
    UILabel*  shareLb=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 35)];
    shareLb.text=@"分    享";
    shareLb.textAlignment=NSTextAlignmentCenter;
    shareLb.textColor=[UIColor whiteColor];
    [shareBtn addSubview:shareLb];
    
    [self.view addSubview:shareBtn];
    
    UIButton* favBtn=[[UIButton alloc] initWithFrame:CGRectMake(160+30, jobY0+h1+15+30+5+30*4+30, 100, 35)];
    favBtn.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"yzh_focus"]];
    [favBtn addTarget:self action:@selector(favFn) forControlEvents:UIControlEventTouchUpInside];
    
    
    UILabel*   favLb=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 35)];
    favLb.text=@"收    藏";
    favLb.textAlignment=NSTextAlignmentCenter;
    favLb.textColor=[UIColor whiteColor];
    [favBtn addSubview:favLb];
    
    [self.view addSubview:favBtn];
    

    
}

//-(void)favFn{
//    NSUserDefaults* ud=[[NSUserDefaults alloc] init];
//    NSString* uid=[ud objectForKey:@"uid"];
//    if(!uid){
//        LoginViewController* ui=[[LoginViewController alloc] init];
//        [self.navigationController pushViewController:ui animated:NO];
//        return;
//    }
//    
//    
//    AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:HOST]];
//    NSString* uidStr=[NSString stringWithFormat:@"%@",uid];
//    //NSString  *sRectuitId=[NSString stringWithFormat:@"%d",self.rectuitId];
//    NSString  *sRectuitId=[NSString stringWithFormat:@"%d",self.jobId];
//    
//    
//    NSString* titleStr=self.dic[@"reqJobName"];
//    if(!titleStr){
//        titleStr=self.dic[@"linkman"];
//    }
//    if(!titleStr){
//        titleStr=@"";
//    }
//    
//    
//    titleStr=[NSString stringWithFormat:@"%@",titleStr];
//    
//    NSString* pic0=self.dic[@"pic0"];
//    NSString* path=[NSString stringWithFormat:@"%@",pic0];
//    
//    NSDictionary*  newDic=@{@"target_id":sRectuitId,@"uid":uidStr,@"title":titleStr,@"path":path,@"flag":@"3"};
//    NSLog(@"newDic=%@", newDic);
//    
//    [httpClient postPath:@"index.php/AppFav/saveFavRecruit" parameters:newDic success:^(AFHTTPRequestOperation *operation, id responseObject) {
//        NSString *responseStr = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
//        
//        NSLog(@"Request Successful, response '%@'", responseStr);
//        dic=[responseStr JSONValue];
//        int code=[dic[@"code"] intValue];
//        if(code==1){
//            [self performSelectorOnMainThread:@selector(successFavFn) withObject:nil waitUntilDone:YES];
//        }
//        if(code==7){
//            [self performSelectorOnMainThread:@selector(failFavFn) withObject:nil waitUntilDone:YES];
//        }
//        
//        
//    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
//        
//        NSLog(@"[HTTPClient Error]: %@", error);
//    }
//     ];
//    
//}
-(void)successFavFn{
    [self.view makeToast:@"收藏成功" duration:1.0 position:@"center"];
}
-(void)failFavFn{
    [self.view makeToast:@"您已经收藏该帖子,请不要重复收藏" duration:1.0 position:@"center"];
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    
}


@end
